#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2025/4/15 15:51
# @Author  : Chenmm
# @File    : SysNotice.py
# @Software: PyCharm


from app import db
from datetime import datetime


class SysNotice(db.Model):
    __tablename__ = 'sys_notice'

    id = db.Column(db.BigInteger, primary_key=True, autoincrement=True)
    title = db.Column(db.String(50), comment='通知标题')
    content = db.Column(db.Text, comment='通知内容')
    type = db.Column(db.SmallInteger, nullable=False, comment='通知类型')
    level = db.Column(db.String(5), nullable=False, comment='通知等级')
    target_type = db.Column(db.SmallInteger, nullable=False, comment='目标类型')
    target_user_ids = db.Column(db.String(255), comment='目标用户ID')
    publisher_id = db.Column(db.BigInteger, comment='发布人ID')
    publish_status = db.Column(db.SmallInteger, default=0, comment='发布状态')
    publish_time = db.Column(db.DateTime, comment='发布时间')
    revoke_time = db.Column(db.DateTime, comment='撤回时间')
    create_by = db.Column(db.BigInteger, nullable=False, comment='创建人ID')
    create_time = db.Column(db.DateTime, default=datetime.now, nullable=False, comment='创建时间')
    update_by = db.Column(db.BigInteger, comment='更新人ID')
    update_time = db.Column(db.DateTime, onupdate=datetime.now, comment='更新时间')
    is_deleted = db.Column(db.SmallInteger, default=0, comment='是否删除')

    __table_args__ = {'comment': '通知公告表'}
